function PayRecord_Code() {
	var buffer = new StringBuffer();
	buffer.append('<div id="payrecord" class="payrecord"><div class="money">回款金额</div><div class="paytype">付款方式</div><div class="qici">期次</div><div class="kaipiao">开票</div><div class="date">回款日期</div></div>');
	buffer.append('<div class="horizen border-bottom"></div>');
	return buffer.toString();
};

function PayRecord_Data(data) {
	var buffer = new StringBuffer();
	$(data).each(function(i,info){
		buffer.append('<div class="payrecordlist border-bottom" id="'+info.ID+'"><div class="money">'+info.Money.toFixed(2)+'</div><div class="paytype">'+info.PayTypeText+'</div><div class="qici">'+info.Period+'期</div><div class="kaipiao">'+info.IsBillText+'</div><div class="date">'+info.BackDate.ToDate()+'</div></div>');
	});
	return buffer.toString();
};

function Receive_PayRecord(pageindex,mbegindate,menddate)
{
	var begindate=RUndefined($("#begindate_search").val());
	var enddate=RUndefined($("#enddate_search").val());
	if(mbegindate){begindate=mbegindate;}
	if(menddate){enddate=menddate;}
	var data = {};
			data.act = "Find_PayRecord";
			data.userid=userid;
			data.comid=comid;
			data.pageindex=pageindex;
			data.source=source;
			data.pagesize=PAGE_SIZE20;
			data.timer = begindate + "～" + enddate;
			data.sign=GetSign(data.act);
			
			mui.getJSON(crm_domain, data, function(json) {
				if(json.data.list.length>0)
				{
					if(pageindex==1)
					{
						$("#contentlist1").html(PayRecord_Data(json.data.list));
					}else{
						$("#contentlist1").append(PayRecord_Data(json.data.list));
					}
					setTimeout(function(){
						myScroll1.refresh();
					},500); //需要延迟500毫秒加载，否则当数量少时不能下拉
					if(json.data.list.length!=data.pagesize)
					{
						$("#loading1").html("");
					}else{
						$("#loading1").html('<img src="img/loading.gif"/>');
					}
				}else
				{
					
					if(pageindex==1)
					{
						$("#contentlist1").html("");
						$("#loading1").html("主人，没有找到您需要的数据"); 
					}
					else
					{
						$("#loading1").html("没有更多了");
					}
				}
				
         		pageindex = parseInt($("#divmsg1").attr("pageindex"))+1;
         		$("#divmsg1").attr("pageindex",pageindex);
			});
};

function PayRecord_Search(){
	pageindex=1;
	$("#divmsg1").attr("pageindex","0");
	Receive_PayRecord(1);
};